/**
 * Created by weikexin .
 **/
import { HTTP } from '../util/http'

class Collect extends HTTP {
  collect (params={}, success) {
    let url = 'CollectManagement/save'
    let data = Object.assign({}, params)
    this.request({
      url: url,
      data: data,
      method: 'POST',
      success
    })
  }

  cancelCollect (params={}, success) {
    let url = 'CollectManagement/cancelCollect'
    let data = Object.assign({},
      params,
      {
        userId: wx.getStorageSync('userInfo').user_id || 0
      })
    this.request({
      url: url,
      data: data,
      method: 'POST',
      success
    })
  }

  statusCollect (params={}, success) {
    let url = 'collect/status'
    let data = Object.assign({},
      params,
      {
        userId: wx.getStorageSync('userInfo').user_id || 0
      })
    this.request({
      url: url,
      data: data,
      success
    })
  }

    collectList (params={}, success) {
        let url = 'CollectManagement/queryCollectManagementList'
        let data = Object.assign({},
            params,
            {
                count: 10
            })
        this.request({
            url: url,
            data: data,
            success,
            method: 'POST'
        })
    }

    myPublish(params = {}, success) {
        let url = 'CollectManagement/queryMyPublishList'
        let data = Object.assign({
          userId: wx.getStorageSync('userInfo').user_id || 0,
          count: 20,
        },
            params
        )
        this.request({
            url: url,
            data: data,
            method: 'POST',
            success
        })
    }
}

export { Collect }